const { Sequelize, DataTypes } = require("sequelize");
const sequelize = require(".");
// 车辆服务
// cityId: 3
// contactPerson: "dsa"
// contactPersonTelephone: "13366667777"
// id: null
// intendedVehicle: "{"1":1,"2":1}"
// itineraryInformation: "tearsad"
// passengerNumber: 2
// patcher: null
// patcherTelephone: null
// remark: null

const Vehicle = sequelize.define(
  "ServiceVehicle",
  {
    id: {
      type: Sequelize.INTEGER,
      primaryKey: true,
      autoIncrement: true,
    },
    cityId: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: null,
    },
    contactPerson: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: null,
    },
    contactPersonTelephone: {
      type: DataTypes.NUMBER,
      allowNull: false,
      defaultValue: null,
    },
    intendedVehicle: {
      type: DataTypes.TEXT,
      allowNull: false,
      defaultValue: null,
    },
    itineraryInformation: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: null,
    },
    passengerNumber: {
      type: DataTypes.NUMBER,
      allowNull: false,
      defaultValue: null,
    },
    patcher: {
      type: DataTypes.STRING,
      defaultValue: null,
    },
    patcherTelephone: {
      type: DataTypes.NUMBER,
      defaultValue: null,
    },
    remark: {
      type: DataTypes.TEXT,
      defaultValue: null,
    }
  },
  {
    timestamps: false,
  }
);

// const createTable = (sequelize) => {

//   return sequelize;
// };
async function deleteAll() {
  await Vehicle.destroy({
    where: {},
    truncate: true,
  });
}
async function create(params) {

}
(async () => {
  await Vehicle.sync(); // Creates the table if it doesn't exist
  // await deleteAll();
  // await create()
})();

module.exports = Vehicle;
